<body>
    <form id="my-form">
        <div id="tools" class="datagrid-toolbar">
            <input type="hidden" name="type" id="type" value="64">
            <a id="subBtn" name="subOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-save"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-save l-btn-icon-left">保存</span></span></a>
            <a id="closeBtn" name="backOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a>
        </div>
        <p id="errorMsg" style="color:red;margin-top:5px;"></p>
        <table class="formTable">
            <tbody>
                <tr>
                    <td class="tdc1" style="width:150px;">
                        部门/项目经理：
                    </td>
                    <td colspan="3">
                        <input type="text" name="applyUserName" id="applyUserName" data-options="required:true"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="applyUserId" id="applyUserId" value="1815">
                        <!-- 				<a class="easyui-linkbutton" id="clear0" iconCls="icon-undo" plain="true" onclick="clearCheck('applyUserName,applyUserId');">清除</a> -->
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        录入意见：
                    </td>
                    <td colspan="3">
                        <textarea name="lrOption" id="lrOption" style="width:732px;height:100px"
                            data-options="required:true" class="easyui-validatebox validatebox-text"></textarea>
                    </td>
                </tr>


                <tr>
                    <td class="tdc1">
                        副总经理：
                    </td>
                    <td colspan="3">
                        <input type="text" name="deptmanagername" id="deptmanagername"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="deptmanagerid" id="deptmanagerid">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear1" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('deptmanagername,deptmanagerid');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        总经理：
                    </td>
                    <td colspan="3">
                        <input type="text" name="managername" id="managername"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="managerid" id="managerid">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear2" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('managername,managerid');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        董事长：
                    </td>
                    <td colspan="3">
                        <input type="text" name="presidentname" id="presidentname"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="presidentid" id="presidentid">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear3" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('presidentname,presidentid');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        姓 名：
                    </td>
                    <td style="width:38%;">
                        <input type="text" name="name" id="name" data-options="required:true"
                            class="easyui-validatebox validatebox-text">
                    </td>
                    <td class="tdc1" style="width:150px;">
                        部 门：
                    </td>
                    <td>
                        <input type="text" name="deptname" id="deptname" data-options="required:true"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        到公司时间：
                    </td>
                    <td>
                        <input type="text" name="inductionDate" id="inductionDate" readonly="readonly"
                            class="easyui-validatebox Wdate validatebox-text"
                            onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" data-options="required:true">
                    </td>
                    <td class="tdc1">
                        续签年数：
                    </td>
                    <td>
                        <input type="text" id="amount" class="easyui-numberbox numberbox-f validatebox-text"
                            numberboxname="amount"><input type="hidden" name="amount" value="">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        续签时间：
                    </td>
                    <td colspan="3">
                        自<input type="text" name="startTime" id="startTime" readonly="readonly"
                            class="easyui-validatebox Wdate validatebox-text"
                            onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'endTime\')}'})"
                            style="width:180px;" data-options="required:true">起至
                        <input type="text" name="endTime" id="endTime" readonly="readonly"
                            class="easyui-validatebox Wdate validatebox-text"
                            onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'startTime\')}'})"
                            style="width:180px;">止
                    </td>
                </tr>
            </tbody>
        </table>
        <br>
        <input type="hidden" name="objectId" id="objectId" value="1761792882832">
        <div id="easyContainer"><input type="file" multiple="" class="fileInput" style="display:none;"><a
                class="formBtn" id="btu_" style="color:#8C8686;" href="javascript:void(0);">上传</a>
            <div class="flist" style="margin-top: 0px;"></div>
        </div>
    </form>

    <br>
    <div id="tools" class="datagrid-toolbar">
        <a onclick="javascript:$.messager.alert('提示','请先保存后再录入劳动合同签订情况');" contextmenu="true:add();"
            class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-add" plain="true" id=""><span
                class="l-btn-left"><span class="l-btn-text icon-add l-btn-icon-left">新增过往劳动合同签订情况</span></span></a>
    </div>
    <div class="panel datagrid" style="width: auto;">
        <div class="datagrid-wrap panel-body panel-body-noheader" title="" style="width: 1279px; height: auto;">
            <div class="datagrid-view" style="width: 1279px; height: 25px;">
                <style type="text/css">
                    div.datagrid-cell-c1-amount {
                        width: 112px;
                    }

                    div.datagrid-cell-c1-startTime {
                        width: undefinedpx;
                    }

                    div.datagrid-cell-c1-endTime {
                        width: undefinedpx;
                    }
                </style>
                <div class="datagrid-view1" style="width: 41px;">
                    <div class="datagrid-header" style="width: 41px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td rowspan="0">
                                            <div class="datagrid-header-rownumber"></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 41px; height: 0px;">
                        <div class="datagrid-body-inner">
                            <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0"
                                style="table-layout: auto;">
                                <tbody></tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-footer" style="width: 41px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <div class="datagrid-view2" style="width: 1238px;">
                    <div class="datagrid-header" style="width: 1238px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td field="id">
                                            <div class="datagrid-header-check"><input type="checkbox"></div>
                                        </td>
                                        <td field="amount">
                                            <div class="datagrid-cell" style="width: 1054px;"><span>签订年数</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="startTime">
                                            <div class="datagrid-cell" style="width: 56px;"><span>开始日期</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="endTime">
                                            <div class="datagrid-cell" style="width: 56px;"><span> 结束日期</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 1238px; height: 0px;">
                        <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0"
                            style="table-layout: auto;">
                            <tbody></tbody>
                        </table>
                    </div>
                    <div class="datagrid-footer" style="width: 1238px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <table id="list_data" style="display: none;"></table>
            </div>
            <div class="datagrid-pager pagination">
                <table cellspacing="0" cellpadding="0" border="0">
                    <tbody>
                        <tr>
                            <td><select class="pagination-page-list">
                                    <option>10</option>
                                    <option>20</option>
                                    <option>30</option>
                                    <option>40</option>
                                    <option>50</option>
                                </select></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-first">&nbsp;</span></span></span></a>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-prev">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><span style="padding-left:6px;">第</span></td>
                            <td><input class="pagination-num" type="text" value="1" size="2"></td>
                            <td><span style="padding-right:6px;">共1页</span></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-next">&nbsp;</span></span></span></a></td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-last">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-load">&nbsp;</span></span></span></a></td>
                        </tr>
                    </tbody>
                </table>
                <div class="pagination-info">显示0到0,共0记录</div>
                <div style="clear:both;"></div>
            </div>
        </div>
    </div>


    <script>
        initSelect(1);//初始化选人框；1：默认根据部门

        //$("#applyUserName").click(function(){
        //   	showSelect('applyUserName,applyUserId','text,id','');
        //});

        $.ajax({
            type: "POST",
            url: contextPath + "manager/approvalprocess/getLoginUser",
            data: null,
            dataType: "json",
            success: function (data) {
                if (data) {
                    $("#applyUserName").val(data.truename);
                    $("#applyUserId").val(data.id);
                }
            },
            error: function (response) {
                $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                    $.messager.alert("提示", response.responseText, 'error');
                });
            }

        });
        $("#deptmanagername").click(function () {
            showSelect('deptmanagername,deptmanagerid', 'text,id', '');
        });

        $("#managername").click(function () {
            showSelect('managername,managerid', 'text,id', '');
        });

        $("#presidentname").click(function () {
            showSelect('presidentname,presidentid', 'text,id', '');
        });

        function checkFormMe(form) {

            return $('#my-form').form('validate');
        }
        var type = $.getUrlParam("type");
        $("#type").val(type);

        var p_id = $.getUrlParam("id");


        var objectId = new Date().getTime();
        if (p_id != null) {
            objectId = p_id;
        }
        $("#objectId").val(objectId);


        var BaseModel = Backbone.Model.extend({ urlRoot: contextPath + 'manager/personRenew' });
        var baseModel;

        if (p_id == null) {
            baseModel = new BaseModel();
        } else {
            baseModel = new BaseModel({ id: p_id, i: new Date().getTime() });
        }
        var baseView = new BaseView({ el: $("#my-form"), model: baseModel });
        if (p_id != null) {
            baseView.doLoad(loadMe);
        }

        function loadMe(model, response, options) {

        }

        //附件
        $('#easyContainer').easyUpload({
            fileTypes: 'all',//all,image,file
            selectText: "上传",//上传按钮文案
            multi: true,//是否允许多文件上传  
            maxNum: 20,//文件上传最大个数
            maxNote: '最多可以上传20个文件，已超出最大上传个数，无法上传！',
            showType: "flist",//展示方。flist,imglist
            fileNote: '文件格式错误，只能上传以下格式',//文件上传说明
            url: contextPath + 'affix',//上传文件地址
            ajaxType: 'POST',//POST,GET
            fileName: 'file',//文件配置参数
            timeout: 300000,//请求超时时间
            formParam: { "objectId": objectId, "objectType": 641 },
        });


        function success(model, response, options) {
            var data = model.get("handleMsg");
            $.messager.alert('提示', model.get("handleMsg").message, 'info', function (rt) {
                if (data.status == 1) {
                    //图层解锁
                    //$("#myForm").unblock();
                    var subtitle = encodeURI(encodeURI($.getUrlParam("subtitle")));
                    window.parent.frames["" + $.getUrlParam("_pfrid")].location.reload();
                    window.location.href = contextPath + "system/qdzxapproval/approval/personrenew_edit.html?type=" + type + "&processid=" + model.get("id") + "&_pfrid=" + $.getUrlParam("_pfrid") + "&_frid=" + $.getUrlParam("_frid") + "&subtitle=" + subtitle;
                } else {
                    $("#errorMsg").html(data.message);
                    //图层解锁
                    //$("#myForm").unblock();
                }
            });
        }

        $('#list_data').datagrid({
            url: contextPath + "manager/personRenewDetails?i=" + new Date().getTime(),
            fitColumns: true,
            singleSelect: false,
            rownumbers: true,
            pagination: true,
            sortName: 'id',
            sortOrder: 'desc',
            method: 'POST',
            onRowContextMenu: onRowContextMenu,//右键菜单
            queryParams: { "bid": 0 },
            columns: [[
                { field: 'id', checkbox: true, width: 100 },
                { field: 'amount', title: '签订年数', width: 120 },
                { field: 'startTime', title: '开始日期' },
                { field: 'endTime', title: ' 结束日期' },
            ]]
        });

    </script>
    <div class="panel window" style="display: none; width: 450px; left: 425.5px; top: 25px;">
        <div class="panel-header panel-header-noborder window-header" style="width: 450px;">
            <div class="panel-title panel-with-icon">根据部门选择</div>
            <div class="panel-icon icon-manager"></div>
            <div class="panel-tool"><a class="panel-tool-collapse" href="javascript:void(0)"></a><a
                    class="panel-tool-close" href="javascript:void(0)"></a></div>
        </div>
        <div id="selectMan" class="easyui-window panel-body panel-body-noborder window-body" title=""
            data-options="closed:true,modal:true,iconCls:'icon-manager',minimizable:false,maximizable:false"
            style="z-index: 301; width: 450px; height: 325px;">
            <div id="selectManHead" class="datagrid-toolbar"><a class="easyui-linkbutton l-btn l-btn-plain"
                    iconcls="icon-ok" plain="true" onclick="checkSelectMan();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-ok l-btn-icon-left">选择</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-reload" plain="true"
                    onclick="reload_data();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-reload l-btn-icon-left">刷新</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close" plain="true"
                    onclick="closeSelectMan();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a></div>
            <div id="menu_tree" class="easyui-tree tree tree-lines" style="margin-top:35px;z-index: 300;"
                data-options="animate:true,lines:true,checkbox:true"></div>
        </div>
    </div>
    <div class="window-shadow" style="display: none; left: 425.5px; top: 25px;"></div>
    <div class="window-mask" style="width: 1301px; height: 518px; display: none;"></div>
    <div id="loading1"
        style="position: absolute; left: 0px; top: 0px; width: 100%; height: 443px; background: rgb(232, 232, 232); opacity: 0.5; z-index: 10000; display: none;">
    </div>
    <div id="loading2" class="panel-loading"
        style="position: fixed; top: 38%; left: 41%; border: 2px solid rgb(149, 184, 231); width: 160px; font-size: 14px; z-index: 10001; background: url(&quot;/system/jquery/themes/themes1/images/loading-1.gif&quot;) 10px 8px no-repeat rgb(255, 255, 255); display: none;">
        正在处理，请稍等...</div>
</body>